import React, {Component} from 'react';

import './index.less';

import {base, high} from 'nc-lightapp-front';

import {render} from '../../../../../hrpub/common/frame';

import MainAction from './actions/main';
import EditAction from './actions/edit';
const {ApprovalTrans} = high;
const {
    NCModal,
    NCButton
} = base;

const {
    Body,
    Header,
    Footer
} = NCModal;

const EntryApply = render({
    actions: {
        mainAct: MainAction,
        editAct: EditAction
    }
})(({props, state, action}) => {
    const {
        entryApplyModalVisible,
        form,
        language,
        assignVisible,
        compositedata
    } = props;

    return (
        <div>
             <NCModal
            show={entryApplyModalVisible}
            onHide={action.mainAct.closeModal}
            onEntered={action.mainAct.modalEntered}
            size='lg'
        >
            <Header
                closeButton={true}
            >
                {language['hi6007-000286'] || '生成入职申请'}
            </Header>
            <Body>
                <div>
                    {form.createForm('entryinfo', {
                        onBeforeEvent: action.editAct.formBeforeEdit,
                        onAfterEvent: action.editAct.formAfterEdit
                    })}
                </div>
            </Body>
            <Footer>
                <div
                    style={{
                        textAlign: 'right'
                    }}
                >
                     <NCButton
                        colors="primary"
                        onClick={action.editAct.submitDeriect}
                        onMouseOver={(e) => {
                            e.target.focus();   
                        }}
                    >
                        {language["hi6007-000318"] /*多语: 保存提交*/}
                    </NCButton>
                    <NCButton
                        colors="primary"
                        onClick={action.editAct.submitBatchAdd}
                        onMouseOver={(e) => {
                            e.target.focus();   
                        }}
                    >
                        {language['hi6007-000179'] || '保存'}
                    </NCButton>
                    <NCButton
                        onClick={action.mainAct.closeModal}
                    >
                        {language['hi6007-000005'] || '取消'}
                    </NCButton>
                </div>
            </Footer>
        </NCModal>

{assignVisible ? <ApprovalTrans
                    title={language["hi6007-000319"] /*多语: 指派*/}
                    data={compositedata}
                    display={assignVisible}
                    getResult={action.editAct.assign}
                    cancel={action.editAct.cancelAssign}
                /> : ""}
        </div>
       
    );
});



export default EntryApply;